/**
 * Created by lenovo on 2017/7/6.
 * 公共类
 */

var cncbk_common_tools = {
    //服务器域名
//    'serverURL': 'http://192.168.0.121:8080/business/',
      'serverURL': 'http://test.wuyoutianxia.com/wy3sj/',
    // 'serverURL': 'http://test.wuyoutianxia.com/wy3sj/',
    //web项目名
    // 'projectName': '/erpapp',
    'projectName': '/business',
    //检测服务器是否可用。
    ' monitorServer': function() {}
}

var serverURL = cncbk_common_tools.serverURL;
var projectName = cncbk_common_tools.projectName;
serverURL += projectName;

$("img").on("error", function() {
    $(this).attr("src", "../../image/error.png");
});

var script = $('<script src="../../js/jquery.cookie.js"><//script>'); //创建script标签
$('head').append(script);

var loggedIn = $.cookie('loggedIn');
console.log(loggedIn);
function logOut() {
	var data = null;
    $.ajax({
        url: cncbk_common_tools.serverURL + '/loginOut',
        type: "post",
        dataType: 'json',
        data: data,
        xhrFields: {
            withCredentials: true
        },
        success: function(res) {
            if (res.code == 200) {
                $.cookie('loggedIn', {expires: -1});
                window.location.href = 'http://47.92.118.122/html/wytx/login.html';
                // window.location.href = 'com_insale.html';
            }
        },
        error: function(err) {
            console.log(err);
        }
    });
}
// $('#signIn').html('<b>'+loggedIn+'</b>')
// console.log($('#signIn'));
// console.log(jQuery.data('#signIn'));
// console.log(jQuery.data('#signIn').text());
